package avicit.cbb.techclass.elefileupdown.service.impl;

import avicit.cbb.techclass.dxcc.JProperties;
import avicit.cbb.techclass.elefileupdown.service.FilePowerService;
import avicit.cbb.techclass.elefileupdown.service.FileUploadEvent;
import avicit.cbb.techclass.elefileupdown.service.FileUploadService;
import avicit.platform6.api.syslookup.SysLookupAPI;
import avicit.platform6.api.syslookup.dto.SysLookupSimpleVo;
import avicit.platform6.api.sysuser.dto.SysUser;
import avicit.platform6.core.domain.BeanBase;
import avicit.platform6.core.exception.DaoException;
import avicit.platform6.core.jdbc.JdbcAvicit;
import avicit.platform6.core.service.ServiceBase;
import avicit.platform6.api.session.SessionHelper;
import avicit.platform6.core.spring.SpringFactory;
import avicit.platform6.modules.system.sysfileupload.dao.SysFileuploadDao;
import avicit.platform6.modules.system.sysfileupload.domain.SysFileUpload;
import avicit.platform6.modules.system.sysfileupload.service.SysFileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.File;
import java.sql.Blob;
import java.util.*;

/**
 * <p>金航数码科技有限责任公司</p>
 * <p>作者：孟飞</p>
 * <p>邮箱：mengf@avicit.com</p>
 * <p>创建时间： 2014-10-21 上午9:10:27 </p>
 * <p>类说明：附件上传下载模块接口实现类</p>
 * <p>修改记录： </p>
 */
//@Component("SwfUploadServeImplCbb")
//@Transactional
@Service("fileUploadServiceCbb")
@SuppressWarnings({"deprecation","unchecked"})
public class FileUploadServiceImpl extends ServiceBase implements FileUploadService {

	@Autowired(required = false)
	private SysFileuploadDao sysFileuploadDao;

	@Resource
	private FileUploadEvent fileUploadEvent;

	@Resource
	private FilePowerService filePowerService;
	
	@Autowired(required = true)
	private JdbcTemplate jdbcTemplate;

	@Autowired(required = false)
	private JdbcAvicit jdbcAvicit;

	@Autowired(required = true)
	private SysLookupAPI upLoader;

	/**
	 * 获取密级下拉列表
	 * @author 孟飞 
	 * @return String
	 * @throws
	 */
	public String getSecretHtml() {
		StringBuilder secretHtml = new StringBuilder();

		// 取得通用代码的值
		Collection<SysLookupSimpleVo> medalTypeList = upLoader.getLookUpListByType("CBB_SECRET");
		Iterator<SysLookupSimpleVo> it = medalTypeList.iterator();
		while (it.hasNext()) {
			SysLookupSimpleVo sl = it.next();
			String value = sl.getLookupCode();
			String name = sl.getLookupName();
			secretHtml.append("<option value ='" + value + "'>" + name + "</option>");
		}

		return secretHtml.toString();
	}

	/**
	 * 获取密级下拉列表
	 * @author 孟飞 
	 * @param attachId
	 * @param secretLevel
	 * @return String
	 * @throws
	 */
	public String getSecretHtml(String attachId, String secretLevel) {
		StringBuilder secretHtml = new StringBuilder();
		secretHtml.append("<select id='select_" + attachId + "'>");

		// 取得通用代码的值
		Collection<SysLookupSimpleVo> medalTypeList = upLoader.getLookUpListByType("CBB_SECRET");
		Iterator<SysLookupSimpleVo> it = medalTypeList.iterator();
		while (it.hasNext()) {
			SysLookupSimpleVo sl = it.next();
			String value = sl.getLookupCode();
			String name = sl.getLookupName();

			if (value.equals(secretLevel)) {
				secretHtml.append("<option value ='" + value + "' selected='true'>" + name + "</option>");
			} else {
				secretHtml.append("<option value ='" + value + "'>" + name + "</option>");
			}
		}

		secretHtml.append("</select>");

		return secretHtml.toString();
	}

	/**
	 * 获取密级Name
	 * @author 孟飞 
	 * @param secretLevel
	 * @return String
	 * @throws
	 */
	public String getSecretName(String secretLevel) {
		// 取得通用代码的值
		Collection<SysLookupSimpleVo> medalTypeList = upLoader.getLookUpListByType("CBB_SECRET");
		Iterator<SysLookupSimpleVo> it = medalTypeList.iterator();
		while (it.hasNext()) {
			SysLookupSimpleVo sl = it.next();
			String value = sl.getLookupCode();
			String name = sl.getLookupName();

			if (value.equals(secretLevel)) {
				return name;
			}
		}

		return "";
	}

	/**
	 * 编辑页面的html生成
	 */
	public Map<String, String> getAttachHtml(String formid, String allowDel, String mongoId) {
		Map<String, String> map = new HashMap<String, String>();
		String html = "";
		String attachSize = "";
		Long vSize = 0L;
		String sql = "SELECT ID,ATTACH_NAME,ATTACH_SIZE,PARENT_TABLE_ID,PARENT_REGISTER_ID," + "DECODE(UPLOAD_PATH,NULL,'TRUE','FALSE') SAVEDB,"
				+ "ATTACH_TYPE,TO_CHAR(CREATION_DATE,'YYYY-MM-DD') CREATION_DATE, SECRET_LEVEL " + "FROM SYS_ATTACHMENT WHERE PARENT_REGISTER_ID = '" + formid
				+ "' ORDER BY CREATION_DATE ASC";
		List<Object[]> list = hibernateDao.findBySQL(sql);
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				Object[] obj = list.get(i);
				String deleteHtml = "";
				if (allowDel.equals("true")) {
					deleteHtml = "删除";
				} else {
					deleteHtml = "";
				}
				vSize = Long.parseLong(obj[2].toString());
				attachSize = getFileSize(vSize);

				String colorStyle = "";
				if (i % 2 != 0) {
					colorStyle = " zsfbxxm_tjfjtabbg ";
				} else {
					colorStyle = "";
				}
				html = html + "<tr  class='datagrid-cell " + colorStyle + "' id='" + obj[0] + "'><td class='uploadTD' width='60%' id='" + obj[0]
						+ "_title'><INPUT TYPE='hidden' id= '" + obj[0] + "_id'" + " NAME='attName' value='" + obj[1] + "'><img src=\"" + getFileIcon(obj[1].toString())
						+ "\" class=\"new-ico-file\"></b><a href='platform/swfUploadControllerCbb/doDownload?mongoId=" + mongoId + "&fileuploadBusinessId=" + obj[4]
						+ "&fileuploadBusinessTableName=" + obj[3] + "&fileuploadIsSaveToDatabase=" + obj[5] + "&fileId=" + obj[0] + "' class='link-black'>"
						+ "<SPAN class=tjfjtm>" + obj[1] + "</span>" + "</a></td>" + "<td class='uploadTD' width='10%'><SPAN>"
						+ this.getSecretHtml((String) obj[0], (String) obj[8]) + "</SPAN></td>" + "<td class='uploadTD' width='10%'><SPAN class=tjfjk>" + attachSize
						+ "</SPAN></td><td class='uploadTD' width='10%'><center><span class='tjfuyc'>已存附件</span></center><span id=" + obj[0]
						+ "_bar></span></td><td class='uploadTD' align=center width='10%'><span id='" + obj[0]
						+ "_del' ><label  class='link-red' style='color:#990000;' onclick = 'javascript:deleteFile(\"" + obj[0] + "\",\"" + obj[1] + "\",this);'>" + deleteHtml
						+ "</label></span></td></tr>";
			}
		}
		map.put("html", html);
		map.put("fileSize", String.valueOf(list.size()));
		map.put("secretHtml", this.getSecretHtml());
		return map;
	}
	
	/**
	 * 获取已上传附件列表
	 * @author 钟一华
	 * @param formid
	 * @param allowDel
	 * @param mongoId
	 * @param param
	 * @return Map<String,String>
	 * @throws
	 */
	@Override
	public Map<String, String> getAttachHtml(String formid, String allowDel, String mongoId, Map<String, Object> param) {
		return null;
	}

	/**
	 * 生成查看页面的html主体
	 */
	public Map<String, String> getAttachViewHtml(String formId, String saveType) {
		Map<String, String> map = new HashMap<String, String>();
		String html = "";
		String attachSize = "";
		Long vSize = 0L;
		String sql = "SELECT ID,ATTACH_NAME,ATTACH_SIZE,PARENT_TABLE_ID,PARENT_REGISTER_ID," + "DECODE(UPLOAD_PATH,NULL,'TRUE','FALSE') SAVEDB,"
				+ "ATTACH_TYPE,TO_CHAR(CREATION_DATE,'YYYY-MM-DD') CREATION_DATE, SECRET_LEVEL " + "FROM SYS_ATTACHMENT WHERE PARENT_REGISTER_ID = '" + formId
				+ "' ORDER BY CREATION_DATE ASC";
		List<Object[]> list = hibernateDao.findBySQL(sql);
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				Object[] obj = list.get(i);
				vSize = Long.parseLong(obj[2].toString());
				attachSize = getFileSize(vSize);
				String colorStyle = "";
				if (i % 2 != 0) {
					colorStyle = " zsfbxxm_tjfjtabbg ";
				} else {
					colorStyle = "";
				}
				html = html + "<tr  class='" + colorStyle + "' id='" + obj[0] + "'><td width='60%' id='" + obj[0] + "_title'><INPUT TYPE='hidden' id= '" + obj[0] + "_id'"
						+ " NAME='attName' value='" + obj[1] + "'><img src=\"" + getFileIcon(obj[1].toString()) + "\" class=\"new-ico-file\"></b>" + "<SPAN class=tjfjtm>" + obj[1]
						+ "</span>" + "</td>" + "<td class='uploadTD' width='10%'><SPAN>" + this.getSecretName((String) obj[8]) + "</SPAN></td>"
						+ "<td class='uploadTD' width='10%' aligh='right'><SPAN class=tjfjk>" + attachSize + "</span></td><td class='uploadTD' align=right width='20%'>"
						+ genPowerHtml(obj[0].toString(), formId, obj[3].toString(), saveType, obj[1].toString()) + "</td></tr>";
			}
		}
		map.put("html", html);
		map.put("fileSize", String.valueOf(list.size()));
		return map;
	}

	/**
	 * 根据权限生成html片段
	 * @author 孟飞 
	 * @param fileId
	 * @param formId
	 * @param formTable
	 * @param saveType
	 * @param fileName
	 * @return String
	 * @throws
	 */
	private String genPowerHtml(String fileId, String formId, String formTable, String saveType, String fileName) {
		String result = "";

		SysUser sysUser = SessionHelper.getLoginSysUser();
		if (sysUser == null) {
			return result;
		}
		Map<String, Boolean> pm = filePowerService.getFilePower(formId, fileId);

		String printHtml = "<input type='hidden' id='fjPrint'></input>";

		String downHtml = "<span style='width:50px;border:0px solid black;'><img src='avicit/cbb/techclass/elefileupdown/swf/images/xxym05.png' class='new-ico-file' /><a class='link-black' href=\"javascript:downloadFile('"
				+ fileId + "','" + formId + "','" + formTable + "','" + saveType + "')\">下载</a></span><input type='hidden' id='fjDownLoad'></input>";
		String viewHtml = "";
		// 浏览查看设置
		String isBrowse_flag = isShowWatch(fileName, fileId); // 临时使用，后期从新建方法中读取
		if (Boolean.parseBoolean(isBrowse_flag)) {
			String fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
			if (JProperties.getFileProperties("picformat").toLowerCase().indexOf(fileType.toLowerCase()) != -1) {// 图片展示方法
				viewHtml = new StringBuffer()
						.append("<span style='width:50px;border:0px solid black;'><img src='avicit/cbb/techclass/elefileupdown/swf/images/xxym06.png' class='new-ico-file' /><a class='link-black' href='javascript:void(0);' onclick=\"$jqeuryBrowsePic(")
						.append("'").append(fileId).append("'").append(")\">浏览</a></span>").toString();
			}else if(JProperties.getFileProperties("videoformat").toLowerCase().indexOf(fileType.toLowerCase()) != -1) {//视频浏览
				viewHtml = new StringBuffer()
				.append("<span style='width:50px;border:0px solid black;'><img src='avicit/cbb/techclass/elefileupdown/swf/images/xxym06.png' class='new-ico-file' /><a class='link-black' href='javascript:void(0);' onclick=\"$jqeuryBrowseVideo(")
				.append("'").append(fileId).append("'").append(" ,'").append(fileType).append("'").append(")\">浏览</a></span>").toString();
			} else {//文件浏览
				viewHtml = new StringBuffer()
						.append("<span style='width:50px;'><img src='avicit/cbb/techclass/elefileupdown/swf/images/xxym06.png' class='new-ico-file' /><a class='link-black'  href='javascript:void(0);' onclick=\"$jqeuryBrowseFile(")
						.append("'").append(fileId).append("'").append(")\">浏览</a></span>").toString();
			}
		} else {
			viewHtml = new StringBuffer().append("<span style='width:50px;'></span>").toString();
		}
		// 返回值
		Boolean p = pm.get("P");
		Boolean b = pm.get("B");
		Boolean d = pm.get("D");
		// 只能浏览
		if (b && !d) {
			result = viewHtml;
		}
		// 只能下载
		else if (!b && d) {
			result = downHtml;
		}
		// 浏览、下载
		else if (b && d) {
			result = viewHtml + "&nbsp;&nbsp;&nbsp;&nbsp;" + downHtml;
		}

		if (p) {
			result = result + printHtml;
		}

		return result;
	}

	/**
	 * 文件是否转换完成可供浏览
	 * @author 孟飞 
	 * @param fileName
	 * @param id
	 * @return String
	 * @throws
	 */
	public String isShowWatch(String fileName, String id) {
		String suffix = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
		if (JProperties.getFileProperties("fileformat").toLowerCase().indexOf(suffix.toLowerCase()) != -1) {// 符合可展示文件格式
			String sql = "select count(1) from CBB_FILE_SWF where FILE_STATUS='10' and ATTACH_ID=? ";
			int size = jdbcTemplate.queryForList(sql, new Object[] {id}).size();
			if (size > 0) {
				return "true";
			} else {
				return "false";
			}
		} else if (JProperties.getFileProperties("picformat").toLowerCase().indexOf(suffix.toLowerCase()) != -1 || suffix.toLowerCase().equalsIgnoreCase("mp4") || suffix.toLowerCase().equalsIgnoreCase("wmv") || suffix.toLowerCase().equalsIgnoreCase("mov")) {// 符合图片展示格式
			return "true";
		} else {
			return "false";
		}
	}

	@Override
	public List<SysFileUpload> getFileListByFormId(String fileuploadBusinessId) {
		String hql = "from SysFileUpload where FILE_BUSINESS_ID = ?";
		List<SysFileUpload> list = sysFileuploadDao.find(hql, fileuploadBusinessId);
		return list;
	}

	@Override
	public String getFileNameById(String formid) {
		String sql = "select attach_name from sys_attachment where id = '" + formid + "'";
		List<String> list = hibernateDao.findBySQL(sql);
		if (list.size() > 0) {
			return list.get(0);
		} else {
			return null;
		}

	}

	@Override
	public SysFileUpload getAttachById(String attachId) {
		SysFileUpload obj = hibernateDao.load(SysFileUpload.class, attachId);
		return obj;
	}

	@Override
	public void deleteAttachById(String attachId) {
		SysFileUpload obj = hibernateDao.load(SysFileUpload.class, attachId);
		hibernateDao.delete(obj);
	}

	@Override
	public void deleteAttachByFormId(String formId) {
		SysFileUploadService sysFileUploadService = SpringFactory.getBean(SysFileUploadService.class);

		String hql = "from SysFileUpload where FILE_BUSINESS_ID = ?";
		List<SysFileUpload> list = sysFileuploadDao.find(hql, formId);

		// 删除物理存储（磁盘存储）的文件
		for (int i = 0; i < list.size(); i++) {
			SysFileUpload sysFileUpload = list.get(i);
			String fileUrl = sysFileUpload.getFILE_URL();

			if (fileUrl != null && !"".equals(fileUrl)) {
				File file = new File(fileUrl);
				if (file.exists()) {
					file.delete();
					// 父文件夹为空时删除
					File folder = file.getParentFile();
					if (folder.list().length == 0) {
						folder.delete();
					}
				}
			}
		}

		// 删除逻辑存储（数据库存储）的文件
		if (!list.isEmpty()) {
			sysFileUploadService.deleteFileByCondition(" where PARENT_REGISTER_ID = '" + formId + "'");
		}
	}

	/**
	 * 获取附件
	 */
	@Override
	public Blob getFileBodyByCondition(Map<String, String> condition) {
		String hql = "from SysFileUpload where id = :fileId";
		SysFileUpload sysFileUpload = sysFileuploadDao.findUnique(hql, condition);
		if (sysFileUpload != null) {
			return sysFileUpload.getFILE_BODY();
		}
		return null;
	}

	/**
	 * 获取文件文件大小的显示
	 * 
	 * @param bitnum
	 * @return
	 */
	public String getFileSize(Long bitnum) {
		Long _K = 1024L;
		Long _M = 1048576L;
		if (bitnum < _M) {
			if (bitnum < _K) {
				return bitnum + "B";
			} else {
				return Math.ceil(bitnum / _K) + "K";
			}

		} else {
			return Math.ceil(100 * bitnum / _M) / 100 + "M";
		}
	}

	/**
	 * 获取图标，原方法和js中的图标不一致，且不太完整，又按js重写了下
	 * 
	 * @param fileName
	 * @return
	 */
	private String getFileIcon(String fileName) {
		// 定义文件图标
		String wrdImg = "avicit/cbb/techclass/elefileupdown/images/word.jpg";
		String xlsImg = "avicit/cbb/techclass/elefileupdown/images/excel.jpg";
		String zipImg = "avicit/cbb/techclass/elefileupdown/images/zip.jpg";
		String rarImg = "avicit/cbb/techclass/elefileupdown/images/rar.jpg";
		String pptImg = "avicit/cbb/techclass/elefileupdown/images/ppt.jpg";
		String txtImg = "avicit/cbb/techclass/elefileupdown/images/txt.jpg";
		String bmpImg = "avicit/cbb/techclass/elefileupdown/images/bmp.jpg";
		String normalImg = "avicit/cbb/techclass/elefileupdown/images/normal.jpg";
		String htmlImg = "avicit/cbb/techclass/elefileupdown/images/html.jpg";
		String pdfImg = "avicit/cbb/techclass/elefileupdown/images/pdf.jpg";
		String jpgImg = "avicit/cbb/techclass/elefileupdown/images/jpg.jpg";
		String gifImg = "avicit/cbb/techclass/elefileupdown/images/gif.jpg";
		String aviImg = "avicit/cbb/techclass/elefileupdown/images/avi.jpg";
		if (fileName.contains(".")) {

			String str = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
			if (str.equals("xls") || str.equals("xlsx") || str.equals("et")) {
				return xlsImg;
			} else if (str.equals("doc") || str.equals("docx") || str.equals("wps")) {
				return wrdImg;
			} else if (str.equals("txt")) {
				return txtImg;
			} else if (str.equals("jpg") || str.equals("png")) {
				return jpgImg;
			} else if (str.equals("gif")) {
				return gifImg;
			} else if (str.equals("pdf")) {
				return pdfImg;
			} else if (str.equals("rar")) {
				return rarImg;
			} else if (str.equals("ppt") || str.equals("pptx") || str.equals("dps")) {
				return pptImg;
			} else if (str.equals("swf")) {
				return aviImg;
			} else if (str.equals("bmp")) {
				return bmpImg;
			} else if (str.equals("zip")) {
				return zipImg;
			} else if (str.equals("html") || str.equals("htm")) {
				return htmlImg;
			} else {
				return normalImg;
			}
		} else {
			return normalImg;
		}
	}

	/**
	 * 修改上传类型
	 */
	@Override
	public void updateUploadType(Map<String, String> param, String mongoId) throws Exception {
		
	}
	
	@Override
	public void delete(BeanBase arg0) throws DaoException {
		// TODO Auto-generated method stub

	}

	@Override
	public void insert(BeanBase arg0) throws DaoException {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(BeanBase arg0) throws DaoException {
		// TODO Auto-generated method stub

	}

	@Override
	public FileUploadEvent getAfterEvent() {
		return this.fileUploadEvent;
	}

	@Override
	public Map<String, String> getAttachViewHtml(String formId, String saveType, Map<String, Object> param) throws Exception {
		String userSecret = (String)param.get("userSecret");
		
		Map<String, String> map = new HashMap<String, String>();
		String html = "";
		String attachSize = "";
		Long vSize = 0L;
		String sql = "SELECT ID,ATTACH_NAME,ATTACH_SIZE,PARENT_TABLE_ID,PARENT_REGISTER_ID," + "DECODE(UPLOAD_PATH,NULL,'TRUE','FALSE') SAVEDB,"
				+ "ATTACH_TYPE,TO_CHAR(CREATION_DATE,'YYYY-MM-DD') CREATION_DATE, SECRET_LEVEL " + "FROM SYS_ATTACHMENT WHERE PARENT_REGISTER_ID = '"
				+formId+"'and SECRET_LEVEL <= "+userSecret+" ORDER BY CREATION_DATE ASC";
		List<Object[]> list = hibernateDao.findBySQL(sql);
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				Object[] obj = list.get(i);
				vSize = Long.parseLong(obj[2].toString());
				attachSize = getFileSize(vSize);
				String colorStyle = "";
				if (i % 2 != 0) {
					colorStyle = " zsfbxxm_tjfjtabbg ";
				} else {
					colorStyle = "";
				}
				html = html + "<tr  class='" + colorStyle + "' id='" + obj[0] + "'><td width='60%' id='" + obj[0] + "_title'><INPUT TYPE='hidden' id= '" + obj[0] + "_id'"
						+ " NAME='attName' value='" + obj[1] + "'><img src=\"" + getFileIcon(obj[1].toString()) + "\" class=\"new-ico-file\"></b>" + "<SPAN class=tjfjtm>" + obj[1]
						+ "</span>" + "</td>" + "<td class='uploadTD' width='10%'><SPAN>" + this.getSecretName((String) obj[8]) + "</SPAN></td>"
						+ "<td class='uploadTD' width='10%' aligh='right'><SPAN class=tjfjk>" + attachSize + "</span></td><td class='uploadTD' align=right width='20%'>"
						+ genPowerHtml(obj[0].toString(), formId, obj[3].toString(), saveType, obj[1].toString()) + "</td></tr>";
			}
		}
		map.put("html", html);
		map.put("fileSize", String.valueOf(list.size()));
		return map;
	}
	
	/**
	 * 根据数据id和附件id获取关系数据
	 * @param recordId
	 * @param attachId
	 * @return
	 * @throws Exception CbbDocRelation
	 * @throws
	 */
	@Override
	public void updateDocRelationByRecordIdAttachIdForDelete(String recordId, String attachId, String status) throws Exception {
		String sql = "UPDATE CBB_DOC_RELATION SET IF_DELETE = '" + status + "' WHERE RECORD_ID = '" + recordId + "' AND ATTACHMENT_ID = '" + attachId + "'";
		this.jdbcAvicit.getJdbcTemplate().execute(sql);
	}

	@Override
	public List<SysFileUpload> getFileListByIds(String attachIds) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String,String> getAttachHtmlByMultiMedia(String formid, String allowDel, String mongoId, Map<String, Object> param) {
		return null;
	}

	@Override
	public String getUploadTypeHtml(Map<String, Object> param) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getUploadTypeHtml() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public Blob getSwfFileBodyByCondition(Map<String, String> condition) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public byte[] getConvertFileBodyByCondition(Map<String, String> condition) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void updateDescribe(Map<String, String> param, String mongoId) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Map<String, String> getAttachDetailHtmlByMultiMedia(String formid, String allowDel, String mongoId, Map<String, Object> param) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, String> getAttachDetailHtmlByDoc(String formid, String allowDel, String mongoId, Map<String, Object> param) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, String> getAttachHtmlByDoc(String formid, String allowDel, String mongoId, Map<String, Object> param) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void updateScanningCopy(Map<String, String> param, String mongoId) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void updateManuscript(Map<String, String> param, String mongoId) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void updateAttachName(Map<String, String> param, String mongoId) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void updateFjtmByTableId(Map<String, String> param) throws Exception{
	}

	@Override
	public void updateAttachOrder(Map<String, String> param, String mongoId) throws Exception {
		// TODO Auto-generated method stub
		
	}

	/**
	 * SanXiaFiles create by zhaoxiaolong 获取附件信息数据集合
	 * @param formId 条目ID
	 * @param ids 待下载ID串
	 * @return
	 */
	@Override
	public List<SysFileUpload> getFileListByFormIdAndIds(String formId, String ids) {
		// TODO Auto-generated method stub
		String hql = "from SysFileUpload where id in (select attachmentId from CbbDocRelation where recordId = ? and ifDelete = 'N' AND attachmentId IN (?) )";
		List<SysFileUpload> list = sysFileuploadDao.find(hql, formId,ids);
		return list;
	}
}


